Imports System.Xml.Serialization
Namespace SSDL

    Public Class [Function]
        Inherits XEntityModelElementWithDocumentationBase

        ''' <summary>Initializes an instance of the <see cref="[Function]" /> class.
        ''' This is the default constructor for this class.</summary>
        Public Sub New()
            MyBase.New("Function", SsdlXmlNamespace)
        End Sub

        ''' <summary>Initializes an instance of the <see cref="[Function]" /> class.</summary>
        ''' <param name="other">An <see cref="System.Xml.Linq.XElement"/> object to copy from.</param>
        Public Sub New(ByVal other As XElement)
            MyBase.New(other)
        End Sub

        Private __parameters As ParameterCollection

        Public Property CommandText() As String
            Get
                Dim name = MyBase.Name.Namespace + "CommandText"
                If (Me.Element(name) Is Nothing) Then
                    Return String.Empty
                End If
                Return Me.Element(name).Value
            End Get
            Set(ByVal value As String)
                Dim name = MyBase.Name.Namespace + "CommandText"
                If (Me.Element(name) Is Nothing) Then
                    Me.Add(New XElement(name))
                End If
                Me.Element(name).Value = value
            End Set
        End Property

        <AutoLoad()> _
        <XmlElement("Parameter", GetType(Parameter))> _
        Public ReadOnly Property Parameters() As ParameterCollection
            Get
                If (__parameters Is Nothing) Then
                    __parameters = New EdmxEditor.SSDL.ParameterCollection(Me, MyBase.Name.Namespace, "Parameter")
                End If
                Return __parameters
            End Get
        End Property

        <XmlAttribute()> _
        Public Shadows Property Name() As String
            Get
                Return Me.@Name
            End Get
            Set(ByVal value As String)
                Me.@Name = value
            End Set
        End Property

        <XmlAttribute()> _
        Public Property ReturnType() As String
            Get
                Return Me.@ReturnType
            End Get
            Set(ByVal value As String)
                Me.@ReturnType = value
            End Set
        End Property

        <XmlAttribute()> _
        Public Property Aggregate() As Boolean
            Get
                Return Me.@Aggregate
            End Get
            Set(ByVal value As Boolean)
                Me.@Aggregate = value
            End Set
        End Property

        <XmlAttribute()> _
        Public Property BuiltIn() As Boolean
            Get
                Return Me.@BuiltIn
            End Get
            Set(ByVal value As Boolean)
                Me.@BuiltIn = value
            End Set
        End Property

        <XmlAttribute()> _
        Public Property StoreFunctionName() As String
            Get
                Return Me.@StoreFunctionName
            End Get
            Set(ByVal value As String)
                Me.@StoreFunctionName = value
            End Set
        End Property

        <XmlAttribute()> _
        Public Property NiladicFunction() As Boolean
            Get
                Return Me.@NiladicFunction
            End Get
            Set(ByVal value As Boolean)
                Me.@NiladicFunction = value
            End Set
        End Property

        <XmlAttribute(), _
         System.ComponentModel.DefaultValue(True)> _
        Public Property IsComposable() As Boolean
            Get
                Return Me.@IsComposable
            End Get
            Set(ByVal value As Boolean)
                Me.@IsComposable = value
            End Set
        End Property

        <XmlAttribute(), _
         System.ComponentModel.DefaultValue(ParameterTypeSemantics.AllowImplicitConversion)> _
        Public Property ParameterTypeSemantics() As ParameterTypeSemantics
            Get
                Return Me.@ParameterTypeSemantics
            End Get
            Set(ByVal value As ParameterTypeSemantics)
                Me.@ParameterTypeSemantics = value
            End Set
        End Property

        <XmlAttribute()> _
        Public Property Schema() As String
            Get
                Return Me.@Schema
            End Get
            Set(ByVal value As String)
                Me.@Schema = value
            End Set
        End Property

        <XmlAttribute("Schema", Form:=System.Xml.Schema.XmlSchemaForm.Qualified, [Namespace]:=EntityStoreSchemaGeneratorXmlNamespace)> _
        Protected Property SchemaGenerator() As String
            Get
                Return Me.Attribute(XName.Get("Schema", EntityStoreSchemaGeneratorXmlNamespace))
            End Get
            Set(ByVal value As String)
                If (Me.Attribute(XName.Get("Schema", EntityStoreSchemaGeneratorXmlNamespace)) Is Nothing) Then
                    Me.Add(New XAttribute(XName.Get("Schema", EntityStoreSchemaGeneratorXmlNamespace), value))
                Else
                    Me.Attribute(XName.Get("Schema", EntityStoreSchemaGeneratorXmlNamespace)).Value = value
                End If
            End Set
        End Property

        <XmlAttribute("Name", Form:=System.Xml.Schema.XmlSchemaForm.Qualified, [Namespace]:=EntityStoreSchemaGeneratorXmlNamespace)> _
        Protected Property NameSchemaGenerator() As String
            Get
                Return Me.Attribute(XName.Get("Name", EntityStoreSchemaGeneratorXmlNamespace))
            End Get
            Set(ByVal value As String)
                If (Me.Attribute(XName.Get("Name", EntityStoreSchemaGeneratorXmlNamespace)) Is Nothing) Then
                    Me.Add(New XAttribute(XName.Get("Name", EntityStoreSchemaGeneratorXmlNamespace), value))
                Else
                    Me.Attribute(XName.Get("Name", EntityStoreSchemaGeneratorXmlNamespace)).Value = value
                End If
            End Set
        End Property

    End Class

End Namespace